// 引入 request 方法，假设 request 方法已经定义在某个工具文件中
import request from '/@/utils/request';
import {
    AddTenantInput, 
    DeleteTenantInput, 
    BaseIdInput,
    TenantMenuInput,
    TenantUserInput,
    TenantIdInput,
    PageTenantInput,
    TenantInput,
    UpdateTenantInput,
} from '../models';
// 定义 API 路径枚举
enum Api {
    SysTenantAdd = '/sysTenant/add',
    SysTenantChangeTenant = '/sysTenant/changeTenant',
    SysTenantCreateDb = '/sysTenant/createDb',
    SysTenantDelete = '/sysTenant/delete',
    SysTenantGoTenant = '/sysTenant/goTenant',
    SysTenantGrantMenu = '/sysTenant/grantMenu',
    SysTenantList = '/sysTenant/list',
    SysTenantPage = '/sysTenant/page',
    SysTenantResetPwd = '/sysTenant/resetPwd',
    SysTenantSetStatus = '/sysTenant/setStatus',
    SysTenantSyncGrantMenu = '/sysTenant/syncGrantMenu',
    SysTenantTenantMenuList = '/sysTenant/tenantMenuList',
    SysTenantUpdate = '/sysTenant/update',
    SysTenantUserList = '/sysTenant/userList',
}

// 定义 API 方法
export const apiSysTenantAddPost = (body?: AddTenantInput) =>
    request({
        url: Api.SysTenantAdd,
        method: 'post',
        data: body,
    });

export const apiSysTenantChangeTenantPost = (body?: BaseIdInput) =>
    request({
        url: Api.SysTenantChangeTenant,
        method: 'post',
        data: body,
    });

export const apiSysTenantCreateDbPost = (body?: TenantInput) =>
    request({
        url: Api.SysTenantCreateDb,
        method: 'post',
        data: body,
    });

export const apiSysTenantDeletePost = (body?: DeleteTenantInput) =>
    request({
        url: Api.SysTenantDelete,
        method: 'post',
        data: body,
    });

export const apiSysTenantGoTenantPost = (body?: BaseIdInput) =>
    request({
        url: Api.SysTenantGoTenant,
        method: 'post',
        data: body,
    });

export const apiSysTenantGrantMenuPost = (body?: TenantMenuInput) =>
    request({
        url: Api.SysTenantGrantMenu,
        method: 'post',
        data: body,
    });

export const apiSysTenantListGet = () =>
    request({
        url: Api.SysTenantList,
        method: 'get',
    });

export const apiSysTenantPagePost = (body?: PageTenantInput) =>
    request({
        url: Api.SysTenantPage,
        method: 'post',
        data: body,
    });

export const apiSysTenantResetPwdPost = (body?: TenantUserInput) =>
    request({
        url: Api.SysTenantResetPwd,
        method: 'post',
        data: body,
    });

export const apiSysTenantSetStatusPost = (body?: TenantInput) =>
    request({
        url: Api.SysTenantSetStatus,
        method: 'post',
        data: body,
    });

export const apiSysTenantSyncGrantMenuPost = (body?: BaseIdInput) =>
    request({
        url: Api.SysTenantSyncGrantMenu,
        method: 'post',
        data: body,
    });

export const apiSysTenantTenantMenuListGet = (id: number) =>
    request({
        url: `${Api.SysTenantTenantMenuList}?Id=${id}`,
        method: 'get',
    });

export const apiSysTenantUpdatePost = (body?: UpdateTenantInput) =>
    request({
        url: Api.SysTenantUpdate,
        method: 'post',
        data: body,
    });

export const apiSysTenantUserListPost = (body?: TenantIdInput) =>
    request({
        url: Api.SysTenantUserList,
        method: 'post',
        data: body,
    });